package com.atguigu.lease.common.context;

//维护ThreadLocal本地线程对象
public class LoginUserContext {
    private static final ThreadLocal<LoginUser> threadLocal = new ThreadLocal<>();

    //向threadlocal对象保存token负载信息
    public static void set(LoginUser loginUser) {
        threadLocal.set(loginUser);
    }

    //从threadlocal对象获取token负载信息
    public static LoginUser get() {
        return threadLocal.get();
    }

    //删除threadlocal对象保存的token负载信息
    public static void remove() {
        threadLocal.remove();
    }
}
